/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CFiltroGrade.java
 *
 * Created on 16/07/2011, 17:42:23
 */
package rpt.bd.cenario;

import java.awt.BorderLayout;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableModel;

/**
 *
 * @author Roberto
 */
public class CFiltroGrade extends javax.swing.JPanel {

    protected CGrade fGrade;

    /** Creates new form CFiltroGrade */
    public CFiltroGrade() {
        initComponents();
    }

    public CGrade getGrade() {
        return null;
    }

    public boolean getRolar() {
        if (getGrade() != null) {
            return getGrade().getRolar();
        } else {
            return true;
        }
    }

    public TableModel getModel() {
        if (getGrade() != null) {
            return getGrade().getModel();
        } else {
            return null;
        }
    }

    public ListSelectionModel getSelectionModel() {
        if (getGrade() != null) {
            return getGrade().getSelectionModel();
        } else {
            return null;
        }
    }

    protected void adicGrade(CGrade aGrade) {
        swScpGrade.setViewportView(aGrade);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        swPnlGrade = new javax.swing.JPanel();
        swScpGrade = new javax.swing.JScrollPane();
        swPnlFiltro = new javax.swing.JPanel();
        swLblFiltro = new javax.swing.JLabel();
        swTxfTextoFiltro = new javax.swing.JTextField();
        swCbxTextoFiltro = new javax.swing.JComboBox();
        swBtnFiltrar = new javax.swing.JButton();

        setLayout(new java.awt.BorderLayout());

        swPnlGrade.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        swPnlGrade.setPreferredSize(new java.awt.Dimension(100, 100));
        swPnlGrade.setLayout(new java.awt.BorderLayout());
        swPnlGrade.add(swScpGrade, java.awt.BorderLayout.CENTER);

        add(swPnlGrade, java.awt.BorderLayout.CENTER);

        swPnlFiltro.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        swPnlFiltro.setPreferredSize(new java.awt.Dimension(100, 70));

        swLblFiltro.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        swLblFiltro.setText("Filtro:");

        swTxfTextoFiltro.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        swCbxTextoFiltro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        swBtnFiltrar.setText("Filtrar");

        javax.swing.GroupLayout swPnlFiltroLayout = new javax.swing.GroupLayout(swPnlFiltro);
        swPnlFiltro.setLayout(swPnlFiltroLayout);
        swPnlFiltroLayout.setHorizontalGroup(
            swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(swPnlFiltroLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(swBtnFiltrar)
                    .addComponent(swLblFiltro))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(swTxfTextoFiltro, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
                    .addComponent(swCbxTextoFiltro, 0, 110, Short.MAX_VALUE))
                .addContainerGap())
        );
        swPnlFiltroLayout.setVerticalGroup(
            swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(swPnlFiltroLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(swTxfTextoFiltro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(swLblFiltro, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(swPnlFiltroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(swCbxTextoFiltro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(swBtnFiltrar))
                .addContainerGap())
        );

        add(swPnlFiltro, java.awt.BorderLayout.SOUTH);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton swBtnFiltrar;
    private javax.swing.JComboBox swCbxTextoFiltro;
    private javax.swing.JLabel swLblFiltro;
    private javax.swing.JPanel swPnlFiltro;
    private javax.swing.JPanel swPnlGrade;
    private javax.swing.JScrollPane swScpGrade;
    private javax.swing.JTextField swTxfTextoFiltro;
    // End of variables declaration//GEN-END:variables
}
